#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/6/17 14:31
# @Author  : jackkli
# @Site    : 
# @File    : callback_robot.py
# @Software: PyCharm

import os
import pyppeteer
import asyncio
from pyppeteer import launch

os.environ['PYPPETEER_CHROMIUM_REVISION'] = '588429'
pyppeteer.DEBUG = True


async def main():
    browser = await launch()
    page = await browser.newPage()
    await page.goto('http://meeting.dashboard.oa.com/d/hmC2OeUZk/ya-ce-guan-zhu-mian-ban?orgId=1&refresh=5s')
    t = await page.content()
    print(t)
    await page.screenshot({'path': 'example.png'})
    await browser.close()


asyncio.get_event_loop().run_until_complete(main())

# import asyncio
# import pyppeteer
# import os
#
# os.environ['PYPPETEER_CHROMIUM_REVISION'] = '588429'
# pyppeteer.DEBUG = True
#
#
# async def main():
#     print("in main ")
#     print(os.environ.get('PYPPETEER_CHROMIUM_REVISION'))
#     browser = await pyppeteer.launch()
#     context = await browser.createIncognitoBrowserContext()
#     page = await context.newPage()
#     await page.goto('http://www.baidu.com')
#
#     content = await page.content()
#     cookies = await page.cookies()
#     await page.screenshot({'path': 'example.png'})
#     await browser.close()
#     return {'content': content, 'cookies': cookies}
#
#
# loop = asyncio.get_event_loop()
# task = asyncio.ensure_future(main())
# loop.run_until_complete(task)
#
# print(task.result())
